* Do monthly states ------------------------------------------------------------
import delimited "./data_py/temp/07_build_states/states_month.csv", clear 

rename v1 month_id

quietly lpoly gas month_id, at(month_id) generate(g) bwidth(1)
quietly lpoly n_available_low month_id, at(month_id) generate(n_l) bwidth(1)
quietly lpoly n_available_mid month_id, at(month_id) generate(n_m) bwidth(1)
quietly lpoly n_available_high month_id, at(month_id) generate(n_h) bwidth(1)

export delimited using "./data_py/processed/states_month.csv", replace

* Do fortnightly states --------------------------------------------------------
import delimited "./data_py/temp/07_build_states/states_fortnight.csv", clear 

rename v1 month_id

quietly lpoly gas month_id, at(month_id) generate(g) bwidth(1)
quietly lpoly n_available_low month_id, at(month_id) generate(n_l) bwidth(1)
quietly lpoly n_available_mid month_id, at(month_id) generate(n_m) bwidth(1)
quietly lpoly n_available_high month_id, at(month_id) generate(n_h) bwidth(1)

export delimited using "./data_py/processed/states_fortnight.csv", replace

* Do 'longer' states --------------------------------------------------------
import delimited "./data_py/temp/07_build_states/states_month_long.csv", clear

rename v1 month_id

quietly lpoly gas month_id, at(month_id) generate(g) bwidth(1)
quietly lpoly n_available_low month_id, at(month_id) generate(n_l) bwidth(1)
quietly lpoly n_available_mid month_id, at(month_id) generate(n_m) bwidth(1)
quietly lpoly n_available_high month_id, at(month_id) generate(n_h) bwidth(1)

export delimited using "./data_py/processed/states_month_long.csv", replace
